/***************************************
Syntax to create Tables OB4-OB6
****************************************/

clear
cd "C:\Users\jar68\OneDrive\Ongoing Work\Party Cues and Suspicion Paper\Final Datavserse\Figure4"
log using "figure4_tables_ob4to6.log"

/*******************************
Table OB4
******************************/

use "pooled_argdiff.dta"
set more off

/********Some Cleaning***********/
label var proarg "Pro Argument" 
label var conarg "Con Argument"
label var argdiff "Pro - Con" 
label var treat "Treatment"
label var polissue "Study & Issue"
encode treat_policy , gen(trp)
label var treat_policy "Policy Treatment"


***Diff Argument
eststo clear
regress argdiff i.treat i.polissue
	estimates store m1
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)
	
regress argdiff i.treat if exp == 1
	estimates store m2
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

regress argdiff i.treat i.trp if exp == 2
	estimates store m3
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)
	
eststo: regress argdiff i.treat i.trp if exp == 3
	estimates store m4
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

esttab m1 m2 m3 m4 using "argdiff.rtf", replace ///
onecell label nobaselevels b(2) se star(* 0.05 ** 0.01 *** 0.001) ///
	mtitles("Pooled" "Exp. 1" "Exp. 2" "Exp. 3") ///
	title("{\b Table OB4:} Argument Polarization (Pro/In - Con/Out)") ///
	stats(N diff sig) 
	
/*******************************
Table OB5
******************************/

clear
use "prox_data.dta"
set more off

eststo clear
regress prox01 i.treat_3 i.stereo 
	estimates store m1
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

/*****Table****/
esttab m1 using "prox_table.rtf", replace ///
onecell label nobaselevels b(2) se star(* 0.05 ** 0.01 *** 0.001) ///
	mtitles("Overall" "State Growth" "Pers. Finances" "Community" "Unemployment" "Poor" "Middle Class" "Rich") ///
	title("{\b Table OB5:} Subjective Proximity, Experiment 3") ///
	stats(N diff sig) 


/*******************************
Table OB6
******************************/

clear
use "inferences_data.dta"
set more off

foreach var in  state_growth pers_finances community unemployment poor middleclass rich { 
	summ `var' 
	replace `var' = (`var' - r(min))/(r(max)-r(min))
}

/******Models*****/
eststo clear
regress inferences i.treat i.stereo 
	estimates store m1
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

regress state_growth i.treat i.stereo 
	estimates store m2
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

regress pers_finances i.treat i.stereo 
	estimates store m3
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

regress community i.treat i.stereo 
	estimates store m4
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)
	
regress unemployment i.treat i.stereo 
	estimates store m5
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

regress poor i.treat i.stereo 
	estimates store m6
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

regress middleclass i.treat i.stereo 
	estimates store m7
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

regress rich i.treat i.stereo 
	estimates store m8
	lincom _b[2.treat] - _b[3.treat]
	estadd scalar diff = r(estimate)
	estadd scalar sig = r(t)

/*****Table****/
esttab m1 m2 m3 m4 m5 m6 m7 m8 using "inferences.rtf", replace ///
onecell label nobaselevels b(2) se star(* 0.05 ** 0.01 *** 0.001) ///
	mtitles("Overall" "State Growth" "Pers. Finances" "Community" "Unemployment" "Poor" "Middle Class" "Rich") ///
	title("{\b Table OB6:} Inferences, Experiment 3") ///
	stats(N diff sig) 

log close
